<?php

# these values need to be changed by you to access your MySQL database

$dbhost    = 'localhost'; # or the i.p. address of your webserver
$dbuser    = 'user';
$dbpass    = 'password';
$dbdbname  = 'databasename';
$dbtblname = 'tablename';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
mysql_select_db($dbdbname);

$data = "";

$data .= "{";
$data .= "\"GET\":";
$data .= json_encode( $_GET );
$data .= ",";

$data .= "\"POST\":";
$data .= json_encode( $_POST );
$data .= "}";

$sql = "INSERT INTO ".$dbtblname." (data) VALUES('".mysql_escape_string($data)."')";

# update the database with our GPS data from the phone
if (!mysql_query($sql,$conn)) {
	# die('testing: '  . mysql_error() );
	die('0');
} else {
	echo "1";
}

mysql_close($conn);

?>
